package com.czkevin.biliwsclient;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;

public class StreamHelper {
    public static byte[] readFully(InputStream is) throws IOException {
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        byte[] buff = new byte[2048];
        int read;
        while((read = is.read(buff)) != -1) {
            bos.write(buff, 0, read);
        }
        is.close();
        return bos.toByteArray();
    }
}
